package profiterole.api;

import java.io.File;

import profiterole.api.Waffle.ReduceStrategy;
import profiterole.mapreduce.MapReduceService;
import profiterole.mapreduce.Splitter;

public class MapReduce {

	private MapReduce() {
		throw new AssertionError("Can't be here");
	}
	
	public static Waffle<?> perform(File folders, ReduceStrategy<?> reduceStrategy) {
		return perform(folders, new OnUpdateStatusCallback() {
			
			@Override
			public void onMediumTwo(String info) {
				
			}
			
			@Override
			public void onMediumOne(String info) {
		
			}
			
			@Override
			public void onInit(String info) {
			
			}
			
			@Override
			public void onFinish(String info) {
				
			}
		}, reduceStrategy);
	}

	public static Waffle<?> perform(File folders, OnUpdateStatusCallback listener, ReduceStrategy<?> reduceStrategy) {

		return MapReduceService.mapReduce(
				Splitter.folderToFileList(folders), listener);
	}

	public static void main(String[] args) {

		// String one = System.getProperty("user.dir") +"/OneFile/";
		Waffle<?> waffle = MapReduce.perform(new File(System.getProperty("user.dir") + "/MapJobs/"), null);
		System.out.println(waffle);
	}
}